package com.qiaoba.module.generator.entity;

import cn.hutool.core.util.ArrayUtil;
import com.qiaoba.common.base.constant.BaseConstant;
import com.qiaoba.module.generator.constant.GenConstants;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 生成 判断逻辑
 *
 * @author ailanyin
 * @date 2023-10-4 11:22:14
 */
@Data
@NoArgsConstructor
public class Generator implements Serializable {

    private GeneratorTable table;

    private List<GeneratorTableColumn> columns;

    private List<GeneratorTableColumn> queryColumns;

    private GeneratorTableColumn pkColumn;

    public boolean isBaseColumn(String column) {
        return ArrayUtil.contains(GenConstants.BASE_ENTITY, column);
    }

    public boolean isQueryColumn(String isQuery) {
        return BaseConstant.YES.equals(isQuery);
    }

    public boolean isPk(String isPk) {
        return BaseConstant.YES.equals(isPk);
    }

    public Generator(GeneratorTable table, List<GeneratorTableColumn> columns) {
        this.table = table;
        this.columns = columns;
    }
}
